package com.snut.tomorrowNews.service.front;

import com.snut.tomorrowNews.dao.front.CommentDao;
import com.snut.tomorrowNews.model.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class CommentService {

    @Autowired
    CommentDao commentDao;

    /**
     * 对文章评论
     */
    public void sendComment(Comment comment) {
        commentDao.insertComment(comment);
    }

    public List<Comment> getCommentByNewsId(Integer newsId) {
        return commentDao.getCommentByNewsId(newsId);
    }

    public List<Comment> getAllComment() {
        return  commentDao.getAllComment();
    }

    public void deleteComment(Integer id) {
        commentDao.deleteComment(id);
    }

    public void passComment(Integer id) {
        commentDao.passComment(id);
    }
}
